package com.atguigu.factory.simplefactory.order;

import com.atguigu.factory.simplefactory.pizza.CheesePizza;
import com.atguigu.factory.simplefactory.pizza.GreekPizza;
import com.atguigu.factory.simplefactory.pizza.PepperPizza;
import com.atguigu.factory.simplefactory.pizza.Pizza;

/**
 * @author LYJ
 * @Description
 * @date 2021 年 09 月 09 日 下午8:47
 */
class SimpleFactory {

     Pizza createPizza(String type) {
        Pizza pizza = null;
        if ("greek".equals(type)) {
            pizza = new GreekPizza();
            pizza.setName("希腊披萨");
        } else if ("cheese".equals(type)) {
            pizza = new CheesePizza();
            pizza.setName("奶酪披萨");
        }else if("pepper".equals(type)){
            pizza = new PepperPizza();
            pizza.setName("胡椒披萨");
        }
        return pizza;
    }

     static Pizza createPizza2(String type) {
        Pizza pizza = null;
        if ("greek".equals(type)) {
            pizza = new GreekPizza();
            pizza.setName("希腊披萨");
        } else if ("cheese".equals(type)) {
            pizza = new CheesePizza();
            pizza.setName("奶酪披萨");
        }
        return pizza;
    }
}
